home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 4150 < prev    next >
Encoding:
Text File  |  1996-08-05  |  3.0 KB  |  85 lines

  1. Newsgroups: comp.lang.c
  2. Path: in2.uu.net!world!mv!usenet
  3. From: ENGR@GSSI.MV.COM (Michael Furman)
  4. Subject: Re: void main() and other atrocities!
  5. Message-ID: <DM45HK.4zG@mv.mv.com>
  6. Mime-Version: 1.0
  7. Organization: GSSI
  8. Date: Thu, 1 Feb 1996 20:12:56 GMT
  9. References: <4eduaj$1aq@grouper.Exis.Net> <4eeeso$b5l@fountain.mindlink.net> <4em17r$shq@jaxnet.jaxnet.com> <4emub9$1mo@fountain.mindlink.net> <4epplj$egf@host-3.cyberhighway.net>
  10. X-Newsreader: WinVN 0.93.10
  11. X-Nntp-Posting-Host: gssi.mv.com
  12.  
  13. In article <4epplj$egf@host-3.cyberhighway.net>, mjellis@cyberhighway.net 
  14. says...
  15. >
  16. >In <4emub9$1mo@fountain.mindlink.net>, genew@mindlink.bc.ca (Gene Wirchenko) 
  17. wri
  18. >tes:
  19. >>     So do many people who post that you can use void main() and other
  20. >>atrocities.
  21. >
  22. >>Sincerely,
  23. >>
  24. >>Gene Wirchenko
  25. >
  26. >Hey...ease up buddy.  I'm one of those idiots that made such a post 'void 
  27. main()
  28. >' and a nice gentlemen sent me an email informing me of the ANSI standard 
  29. regard
  30. >ing this.
  31. >
  32. >Because of this nice gentlemen's information, now I know better.  And, he 
  33. didn't
  34. > scare me off this newsgroup be blowing my head off with a cannon!  Email 
  35. works 
  36. >wonders and it's *so* much more courteous.
  37.  
  38. And by the way, number of C/C++ implementations allow "void main(.." as a
  39. language extension. Don't get me wrong - I strongly don't recommend using
  40. this extention, like any unportable staff without some reason - and I
  41. can't realize what reason is to use/allow this extention.
  42.  
  43. Heare is quote from MS Visual C/C++ help:
  44. >>>>> begin >>>>>
  45. A special function called main is the entry point to all C++ programs. This 
  46. function is not predefined by the compiler; rather, it must be supplied in 
  47. the program text. If you are writing code that adheres to the Unicode 
  48. programming model, you can use the wide-character version of main, wmain. The 
  49. declaration syntax for main is:
  50. int main( );
  51.   
  52. or, optionally:
  53. int main( int argc[ , char *argv[ ] [, char *envp[ ] ] ] );
  54.   
  55. The declaration syntax for wmain is as follows:
  56. int wmain( );
  57.   
  58. or, optionally:
  59. int wmain( int argc[ , wchar_t *argv[ ] [, wchar_t *envp[ ] ] ] );
  60.   
  61. Alternatively, the main and wmain functions can be declared as returning void 
  62. (no return value). If you declare main or wmain as returning void, you cannot 
  63. return an exit code to the parent process or operating system using a return 
  64. statement; to return an exit code when main or wmain are declared as void, 
  65. you must use the exit function.
  66. >>>>>> end >>>>>>
  67.  
  68.  
  69. >
  70. >John Ellis                                   
  71. >mjellis@cyberhighway.net                     
  72. >john@ici.usa.net                             
  73. >Idaho Central Interchange BBS: (208) 677-2028
  74. >
  75.  
  76. -- 
  77. <<<<<<<< This is a copy of post to the newsgroup >>>>>>>>
  78. ---------------------------------------------------------------
  79. Michael Furman,                       (603)893-1109
  80. Geophysical Survey Systems, Inc.  fax:(603)889-3984
  81. 13 Klein Drive - P.O. Box 97          engr@gssi.mv.com 
  82. North Salem, NH 03073-0097            71543.1334@compuserve.com
  83. ---------------------------------------------------------------
  84.  
  85.